package com.ztx.service.manager.impl;

import java.util.List;

import javax.annotation.Resource;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.ztx.model.QkInfo;
import com.ztx.pagemodel.easyui.DataGrid;
import com.ztx.pagemodel.easyui.PageHelper;
import com.ztx.service.manager.IQkQueryService;

@Repository(IQkQueryService.BEAN_ID)
public class QkQueryServiceImpl implements IQkQueryService {

	@Resource
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public DataGrid<QkInfo> getQkList(PageHelper ph, QkInfo params) {
		long total = sqlSessionTemplate.selectOne(QkInfo.class.getName()
				+ ".queryQkInfoCount", params);
		List<QkInfo> rows = sqlSessionTemplate.selectList(
				QkInfo.class.getName() + ".queryQkInfo", params,
				ph.getRowBounds());
		DataGrid<QkInfo> datagrid = new DataGrid<>();
		datagrid.setTotal(total);
		datagrid.setRows(rows);
		return datagrid;
	}
}
